<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'emp_add.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<link rel="stylesheet" type="text/css" href="css/emp_add.css">
<link href="css/sunny/jquery-ui-1.10.2.custom.css" rel="stylesheet">
<script src="js/jquery/jquery-1.9.1.js"></script>
<script src="js/jquery/jquery-ui-i18n.js"></script>
<script src="js/jquery/jquery-ui-1.10.2.custom.js"></script>
<script language="JavaScript" type="text/javascript" src="js/emp_add.js"></script>
<script>
	$(function() {
		$("#datepicker").datepicker({
			changeYear : true,
			dateFormat :  'yy-mm-dd'
		});
		
	});
</script>
<script>
	var req;
	window.onload = function() {//页面加载时的函数
	}

	function Change_Select() {//当第一个下拉框的选项发生改变时调用该函数
		var province = document.getElementById('province').value;
		var url = "select?dept_id=" + escape(province);
		if (window.XMLHttpRequest) {
			req = new XMLHttpRequest();
		} else if (window.ActiveXObject) {
			req = new ActiveXObject("Microsoft.XMLHTTP");
		}
		if (req) {
			req.open("GET", url, true);
			//指定回调函数为callback
			req.onreadystatechange = callback;
			req.send(null);
		}
	}
	//回调函数
	function callback() {
		if (req.readyState == 4) {
			if (req.status == 200) {
				parseMessage();//解析XML文档
			} else {
				alert("不能得到描述信息:" + req.statusText);
			}
		}
	}
	//解析返回xml的方法
	function parseMessage() {
		var xmlDoc = req.responseXML.documentElement;//获得返回的XML文档
		var xSel = xmlDoc.getElementsByTagName('select');
		//获得XML文档中的所有<select>标记
		var select_root = document.getElementById('city');
		//获得网页中的第二个下拉框
		select_root.options.length = 0;
		//每次获得新的数据的时候先把每二个下拉框架的长度清0

		for ( var i = 0; i < xSel.length; i++) {
			var xValue = xSel[i].childNodes[0].firstChild.nodeValue;
			//获得每个<select>标记中的第一个标记的值,也就是<value>标记的值
			var xText = xSel[i].childNodes[1].firstChild.nodeValue;
			//获得每个<select>标记中的第二个标记的值,也就是<text>标记的值

			var option = new Option(xText, xValue);
			//根据每组value和text标记的值创建一个option对象

			try {
				select_root.add(option);//将option对象添加到第二个下拉框中
			} catch (e) {
			}
		}
	}
</script>
</head>
<body>
	<h3>员工信息添加</h3>
	<div id="container">
		<form id="fm-form" method="post"
			action="performanceAction!updatePerformance.action">
			<fieldset>
				<div class="fm-req">
					<label for="fm-firstname">员工姓名</label> <input
						name="performance.emp_name"  value='<s:property value="performance.performance_emp_name" />' type="text">
						<input type="hidden" name="performance.performance_emp_id"  value='<s:property value="performance.performance_emp_id" />'/>
				</div>
				
				<div class="fm-req">
					<label for="fm-firstname">日期</label> 
						<input type="text" id="datepicker" name="performance.performance_date" id="fm-firstname" type="text" value='<s:property value="performance.performance_date" />'>
				</div>
				<%--<div class="fm-req">
					<label for="fm-firstname">奖励</label> <input name="performance.performance_reward"
						id="fm-firstname" type="text" value='<s:property value="performance.performance_reward" />'>
				</div>
				<div class="fm-req">
					<label for="fm-firstname">扣除</label> <input name="performance.performance_penalty"
						id="fm-firstname" type="text" value='<s:property value="performance.performance_penalty" />'>
				</div>
				--%>
				<div class="fm-req">
					<label for="fm-firstname">类型</label> <select 
						name="performance.performance_treat_type">
						<option value="奖励" >请选择</option>
						<option value="奖励" >奖励</option>
						<option value="处罚" >处罚</option>
						</select>
				</div>
				<div class="fm-req">
					<label for="fm-firstname">金额</label> <input
						name="performance.performance_treat_amount"  value='<s:property value="performance.performance_treat_amount" />'
						type="text">
				</div>
				<div class="fm-opt">
					<label for="fm-city">原因</label>
					<textarea name="performance.performance_reason" cols="10" rows="5"
						id="fm-comments"><s:property value="performance.performance_reason" />'</textarea>
				</div>
			</fieldset>
			<div id="fm-submit" class="fm-req">
				<input name="Submit" value="&#25552; &#20132;" type="submit">
			</div>
			<br>
		</form>
	</div>
</body>
</html>
